package com.dux.commons.scripts.java;

import java.util.Arrays;


/**
 * 脚本编译结果类
 * @author 杜祥
 * @create 2013-5-11
 */
public class CompilationResult 
{
	
	/**
	 * 被编译的类列表
	 */
	private final Class<?>[] compiledClasses;
	
	
	/**
	 * 脚本类的加载器
	 */
	private final ScriptClassLoader classLoader;
	
	
	/**
	 * 创建一个实例
	 * @param compiledClasses
	 * 						由编译器编译后的类	
	 * @param classLoader
	 * 						类加载器
	 */
	public CompilationResult(Class<?>[] compiledClasses, ScriptClassLoader classLoader)
	{
		this.compiledClasses = compiledClasses;
		
		this.classLoader = classLoader;
	}
	
	
	/**
	 * 返回类加载器
	 * @return
	 * 				类加载器
	 */
	public ScriptClassLoader getClassLoader()
	{
		return classLoader;
	}
	
	
	/**
	 * 返回被编译的类列表
	 * @return
	 * 			被编译的类列表
	 */
	public Class<?>[] getCompiledClassed()
	{
		return compiledClasses;
	}


	@Override
	public String toString()
	{
		final StringBuilder sb = new StringBuilder();
		sb.append("CompilationResult");
		sb.append("{classLoader=").append(classLoader);
		sb.append(", compiledClasses=").append(
			compiledClasses == null ? "null" : Arrays.asList(compiledClasses).toString());
		sb.append('}');
		
		return sb.toString();
	}
	
	
	
	
	
	
	
}
